package com.GameSpace.CoreAssets;

import com.GameSpace.SameGame.R;

import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import android.widget.Button;

public class RoundedButton extends Button{

	private float radius = 10;
	private int color = R.color.gray;
	
	@Override
	public void setBackgroundColor(int c){
		this.color=c;
		this.doRoundedButton();
	}
	
	public RoundedButton(Context ctx){
		super(ctx);
		this.doRoundedButton();
	}
	
	public RoundedButton(Activity act){
		super(act);
		this.doRoundedButton();
	}	
	
	
	public void setRadius(float r){
		this.radius=r;
		this.doRoundedButton();
	}
	
	private void doRoundedButton(){
		GradientDrawable g = new GradientDrawable();
		g.setCornerRadius(this.radius);
		g.setColor(this.color);
		this.setBackgroundDrawable(g);
	}

}